/**
 * @date 3:04:36 PM
 * EducationStudent.java
 * Administrator
 * TODO
 */
package com.qs.education.bean.entity;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

/**
 * @class EducationStudent：学生实体
 * @author Warren
 * @description
 * @date Oct 31, 2018 
 */
@Entity
@Table(name="education_student")
@Getter
@Setter
@JsonIgnoreProperties(value = { "password" })
public class EducationStudent {
	@Id
	@Column(name="id" ,unique=true,nullable=false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	private String name;
	private String password;
	private Integer age;
	@Column(name="mobile",unique=true,nullable=false)
	private String mobile;
	private String headImage;
	private Integer sex;
	private Date createDate;
	private String createTime;
	@Column(name="token")
	private String stuToken;
	
	@ManyToOne
	@JoinColumn(name="school_id")
	@JsonIgnoreProperties(value = { "students" , "teachers" })
	private EducationSchool school;
	
	@ManyToMany(cascade=CascadeType.ALL)
	@JoinTable(name = "education_student_group" ,
			joinColumns = {@JoinColumn(name="student_id" ,referencedColumnName="id")},
			inverseJoinColumns = {@JoinColumn(name="group_id", referencedColumnName="id")})
	@JsonIgnoreProperties(value = { "teachers" , "students" , "teacher","grade","clazz","homeWorkList" })
	private List<EducationGroup> groups;
	
	@ManyToOne
	@JoinColumn(name="grade_id")
	private EducationGrade grade;
	
	@ManyToOne
	@JoinColumn(name="class_id")
	private EducationClass clazz;
	
}
